home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-28 | 5.8 KB | 273 lines | [TEXT/sLiN] |
- !
- ! LineShare™ Script for Supra v32bis data-fax modems
- ! This script is designed for Class 2 fax software and -
- ! ••• Make sure that you have "H" or better ROMs in your modem!
- !
- ! If you want to modify this script for your modem, pay attention to
- ! the line marked "#### Settings ####" - it should be modified first
- ! This script is written to use with ARA on the "Data" subPort, so
- ! the modem is set to the "no correction/compression" mode
- !
-
- ! ------------------------------------------
- ! Resetting the modem:
- ! ------------------------------------------
- @Hangup
- SetTries 2
- Flush
- HsReset 0,0,17,19,0,0
- !
- ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
- ! to enter the command mode
- !
- @Label 1
- matchclr
- matchstr 1 2 "OK\r\n"
- write "ATH0&F1\r"
- matchread 20
- Write "+++"
- DtrClear
- pause 10
- DtrSet
- !
- DecTries
- IfTries 0 1
- !
- ! OSErr -6019 "Modem error - the modem is not responding"
- !
- exit -6019
- @Label 2
- write "AT+FCLASS=0\r"
- Jsr 100
- write "AT+FAA=0\r"
- Jsr 100
- exit 0
- ! ------------------------------------------
- ! Receiving incoming calls
- ! ------------------------------------------
- @ANSWER
- @Label 10
- !
- ! Set the modem preferred speed first
- !
- SERRESET 2400,0,8,1
- Jsr 80
- !
- ! Set the common options
- Jsr 70
- !
- ! Set the communication options:
- ! • X4: Extended response set
- ! • N1: Connect at the highest rate
- ! • \N1: Direct connection (for ARA)
- ! • &K4: Xon/Xoff flow control (for Fax)
- ! • W2: report connection speed
- !
- @Label 11
- ! #### Settings - change this according to the type of modem you have ####
- Write "ATX4N1\\N1&K4W2\r"
- Jsr 100
- !
- ! Set the "work" speed
- !
- @Label 12
- SERRESET 19200,0,8,1
- Jsr 80
- !
- ! Set Fax parameters: LID, DCC,BOR
- !
- Write "AT+FCLASS=2\r"
- Jsr 100
- Write "AT+FLID=\"Stalker_GmbH\"\r"
- Jsr 100
- Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
- Jsr 100
- Write "AT+FBOR=1\r"
- Jsr 100
- !
- ! Allow modem to receive fax messages
- !
- Write "AT+FCR=1\r"
- Jsr 100
- !
- ! Tell the modem to determine the type of the incoming call
- ! Fetch the tube after N rings, where N has been set in the control panel (^4)
- !
- Write "ATS0=^4+FAA=1\r"
- Jsr 100
- !
- ! Everything is ready - let's sit and wait for a call
- ! We'll wait for 2 minutes, then reinitiate the modem
- !
- @Label 20
- MatchClr
- matchstr 1 20 "RING\r\n"
- matchstr 2 21 "\r\nCONNECT"
- matchstr 3 24 "\r\n+FCON"
- matchstr 4 10 "\r\nNO "
- matchstr 5 10 "\r\nBUSY"
- Matchread 1200
- jump 10
- !
- ! Data connection has been established (we read "CONNECT")
- ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
- ! if it was an incoming call, put the "RING" before the "CONNECT"
- !
- @Label 21
- LogMsg "Data call…"
- QueueInput "\r\nCONNECT"
- ifOriginate 22
- QueueInput "\r\nRING\r\n"
- @Label 22
- Attach "Data" (DTR,Escape,TimeLimit=0)
- !
- ! Fax connection has been established (we read "+FCON")
- ! Put the +FCON back to the buffer,
- ! if it was an incoming call, put the "RING" before the "+FCON"
- ! Attach the "Fax" subPort
- !
- @Label 24
- QueueInput "\r\n+FCON"
- ifOriginate 25
- QueueInput "\r\nRING\r\n"
- @Label 25
- Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
- ! ------------------------------------------
- ! Originating a call through the "Data" subport
- ! ------------------------------------------
- @ORIGINATE "Data"
- !
- ! Set the Data speed
- !
- SERRESET 19200,0,8,1
- Jsr 80
- !
- ! Set the common options
- !
- Jsr 70
- !
- ! Set the Data mode:
- ! • X4: Extended response set
- ! • N1: Connect at the highest rate
- ! • \N1: Direct connection (no compression, correction - for ARA)
- ! • &S1: DSR according to CCITT (if the cable connects CTS with DSR, not DCD)
- ! • S7: time-out (90 sec) for long-distance call (if you use them)
- !
- ! #### Settings - change this according to the type of modem you have ####
- Write "ATX4N1\\N1&S1S7=90\r"
- Jsr 100
- !
- ! Now emit all commands that the application has sent to that port
- ! (if we use ARA/LineShare script, no commands were sent)
- !
- Jsr 60
- !
- ! Prepare to receive all error result codes
- !
- Jsr 90
- matchstr 1 21 "\r\nCONNECT"
- !
- ! Dial the number
- !
- HsReset *
- Write "ATD^1\r"
- MatchRead 900
- Write "\r"
- Exit -6019
- ! ------------------------------------------
- ! Originating a call through the "Fax" subPort
- ! ------------------------------------------
- @ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nNO DIALTONE\r\n")
- !
- ! Set the "Fax" speed
- !
- SERRESET 19200,0,8,1
- Jsr 80
- !
- ! Set the common options
- !
- Jsr 70
- !
- ! Set the Fax mode
- ! &S0: DSR always on (see above)
- !
- Write "AT&S0+FCLASS=2\r"
- Jsr 100
- !
- ! Now emit all commands that the application has sent to that port,
- ! Prepare to receive all error result codes
- !
- @LABEL 50
- Jsr 60
- Jsr 90
- MatchStr 1 24 "\r\n+FCON"
- HsReset *
- Write "ATD^1\r"
- MatchRead 700
- Write "\r"
- Exit -6019
- !
- ! This section emits all modem commands sent from the client application
- ! For each set of commands the "OK" answer is awaited
- !
- @Label 60
- EmitStart
- @Label 61
- EmitCommand 62
- Jsr 100
- Jump 61
- @Label 62
- return
- !
- ! This section initiates the modem before ANSWER and ORIGINATEs:
- ! factory settings + speaker control +
- ! reset on Dtr drop + DCD valid
- ! Verbal responses mode, no echo
- !
- @Label 70
- Write "ATM^2L^3&D3&C1V1E0\r"
- Jsr 100
- return
- !
- ! This section syncronize the modem after the serial port speed switching
- !
- @Label 80
- ChrDelay 1
- Write "AT\r"
- ChrDelay 0
- Jsr 100
- return
- !
- ! Prepare to receive error result codes
- !
- @Label 90
- MatchClr
- MatchStr 2 91 "NO DIALTONE\r\n"
- MatchStr 3 92 "BUSY\r\n"
- MatchStr 4 93 "NO CARRIER\r\n"
- MatchStr 5 94 "NO ANSWER\r\n"
- return
- @Label 91
- exit -6020
- @Label 92
- exit -6022
- @Label 93
- exit -6021
- @Label 94
- exit -6023
- !
- ! Processing the AT command:
- ! OK -> proceed
- ! ERROR or TimeOut ->exit -6019
- ! It can be called AFTER the "Write" command, since LineShare buffers input
- !
- @Label 100
- MatchClr
- MatchStr 1 102 "\r\nOK\r\n"
- MatchStr 2 101 "\r\nERROR\r\n"
- MatchRead 20
- @Label 101
- Exit -6019
- @Label 102
- return
-